package com.imiku.controller;

import com.alibaba.fastjson.JSONObject;
import com.imiku.service.MenuService;
import com.imiku.utils.JsonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/menu")
public class MenuInfoController {

    @Autowired
    private MenuService menuService;

    @RequestMapping("/findAll") // 获取用户信息。/auth/user
    public String findAllMenu() {
        JSONObject jsonObject = JsonUtils.getJsonObject(1, "成功");
        jsonObject.put("list", menuService.findByParentId());
        return jsonObject.toJSONString();
    }
}
